package object02;

/**
 * @TODO
 * @Author xu
 * 2025/3/12
 */
public class Person {
    private String name;     // 姓名
    private String gender;   // 性别
    private int age;         // 年龄
    private String qqNumber; // QQ号码

    // 构造函数


    public Person() {
    }
    public Person(String name, String gender, int age, String qqNumber) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.qqNumber = qqNumber;
    }

    // 打印个人信息


    // 判断QQ号是否合法
    public boolean isValidQQNumber() {
        // QQ号必须全部是数字，第一位非0，长度为5到12位
        return qqNumber.matches("^[1-9]\\d{4,11}$");
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return gender
     */
    public String getGender() {
        return gender;
    }

    /**
     * 设置
     * @param gender
     */
    public void setGender(String gender) {
        this.gender = gender;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     * 获取
     * @return qqNumber
     */
    public String getQqNumber() {
        return qqNumber;
    }

    /**
     * 设置
     * @param qqNumber
     */
    public void setQqNumber(String qqNumber) {
        this.qqNumber = qqNumber;
    }

    public String toString() {
       return "Person{name = " + name + ", gender = " + gender + ", age = " + age + ", qqNumber = " + qqNumber + "}";
    }
}
